FROM golang:1.21.5 AS build-env
ENV GOPROXY https://goproxy.cn
ADD . /go/src/app
WORKDIR /go/src/app
RUN go mod tidy
RUN CGO_ENABLED=0 go build -o inspector cmd/app/main.go

FROM alpine:3.19.0
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
    apk add -U tzdata
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY --from=build-env /go/src/app/inspector /usr/local/bin/inspector
COPY --from=build-env /go/src/app/configs /configs
RUN mkdir /log
EXPOSE 8090
ENTRYPOINT ["inspector"]